<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>分页组件的演示</title>
    <link rel="stylesheet" href="../layui/css/layui.css">
    <script src="../layui/layui.js"></script>
</head>
<body>
<div id="test"></div>
<script>
    layui.use(['laypage'],function(){
       var laypage=layui.laypage;
        laypage.render({
            elem:'test',
            //elem:document.getElementById('test')
            count:70,
            groups:5,
            prev:'上页',
            next:'下页',
            first:'首页',
            last:'尾页',
            curr:2,
            layout:['skip','prev', 'page','next','limit','count'],
            limits:[10,20,30,50],
            limit:30,
            theme:'#c00',
            jump: function(obj, first) {
                //obj包含了当前分页的所有参数，比如：
                console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
                console.log(obj.limit); //得到每页显示的条数
                //首次不执行
                if (!first) {
                    //do something
                    console.log('hehe');
                }
            }
        });
    });
</script>
</body>
</html>